<?php
include_once( 'initlite.php' );
if($_POST["status"] || $_POST["repost"]){
	if($_POST["repost"]){
		$thistimeline = $c->repost(trim($_POST["repost"]),trim($_POST["status"]));
	}
	else{
		if($_POST["image"]){
			if(substr(trim($_POST["image"]),0,4) == "data"){
				$imgurl = getBase64Image($_POST["image"]);
				$thistimeline = $c->upload(trim($_POST["status"]),$imgurl);
			}
			else{
				$thistimeline = $c->upload(trim($_POST["status"]),$_POST["image"]);
			}
		}
		else{
			$thistimeline = $c->update(trim($_POST["status"]));
		}
	}
	if($thistimeline["error_code"]){
		echo $thistimeline["error_code"];
	}
	else{
		cacheWeibo($thistimeline);
		echo "000000000000000";
	}
}
?>